package com.thinksns.sociax.t4.model;

import com.thinksns.sociax.thinksnsbase.bean.SociaxItem;
import com.thinksns.sociax.thinksnsbase.exception.DataInvalidException;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zhiyicx on 2017/5/11.
 */

public class ModelEventComment extends SociaxItem {

    private int count;
    private int totalPages;
    private int totalRows;
    private int nowPage;
    private String html;

    private List<ModelComment> comments;

    public int getCount() {
        return count;
    }

    public int getTotalPages() {
        return totalPages;
    }

    public int getTotalRows() {
        return totalRows;
    }

    public int getNowPage() {
        return nowPage;
    }

    public String getHtml() {
        return html;
    }


    public List<ModelComment> getComments() {
        return comments;
    }

    public void setComments(JSONArray array) {
        if (array == null) return;
        if (comments == null) comments = new ArrayList<>();
        try {
            for (int i = 0; i < array.length(); i++) {
                comments.add(new ModelComment(array.getJSONObject(i)));
            }
        } catch (JSONException e) {
            e.printStackTrace();
        } catch (DataInvalidException e) {
            e.printStackTrace();
        }
    }

    public void setComments(List<ModelComment> comments) {
        if (comments == null)
            this.comments = new ArrayList<>();
        else
            this.comments = comments;
    }

    @Override
    public boolean checkValid() {
        return false;
    }

    @Override
    public String getUserface() {
        return null;
    }
}
